package com.cssw.fyzb.wap.service;

import com.cssw.fyzb.base.web.domain.AjaxData;
import com.cssw.fyzb.base.web.domain.AjaxPage;
import com.cssw.fyzb.wap.model.vo.AddAppealVo;
import com.cssw.fyzb.wap.model.vo.AppealTypeVo;
import com.cssw.fyzb.wap.model.vo.AppealVo;
import com.cssw.fyzb.wap.model.vo.ImgVo;
import com.cssw.fyzb.wap.util.FileUtil;
import com.ydn.appserver.MinaAppClient;
import com.ydn.appserver.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.ArrayList;
import java.util.List;


/**
 * @author
 */
@Service
public class AppealService extends BaseService {

    @Autowired
    private MinaAppClient busiClient;

    /**
     * 用户的申述
     *
     * @return com.cssw.fyzb.base.web.domain.AjaxData<com.cssw.fyzb.wap.model.vo.AppealVo>
     * @Param [userId]
     **/
    public AjaxPage<AppealVo> listAppeal(Long userId, int pageNumber, int pageSize) {
        Request request = new Request("ListAppeal");
        request.setParameter("userId", userId);
        request.setParameter("pageNumber", pageNumber);
        request.setParameter("pageSize", pageSize);
        return convertPage(busiClient.send(request), AppealVo.class);
    }

    /**
     * 申述详情
     *
     * @return com.cssw.fyzb.base.web.domain.AjaxData<com.cssw.fyzb.wap.model.vo.AppealVo>
     * @Param [appealId]
     **/
    public AjaxData<AppealVo> getAppeal(Long appealId) {
        Request request = new Request("GetAppeal");
        request.setParameter("appealId", appealId);
        return convertData(busiClient.send(request));
    }

    /**
     * 申述
     *
     * @return com.cssw.fyzb.base.web.domain.AjaxData<com.cssw.fyzb.wap.model.vo.AddAppealVo>
     * @Param [appealId]
     **/
    public AjaxData<AddAppealVo> saveAppeal(Long userId, String appealType, String contact, String appeal, String appealAttach) {
        Request request = new Request("SaveAppeal");
        request.setParameter("userId", userId);
        request.setParameter("appealType", appealType);
        request.setParameter("contact", contact);
        request.setParameter("appeal", appeal);
        request.setParameter("appealAttach", appealAttach);
        return convertData(busiClient.send(request));
    }

    /**
     * 申述类型
     *
     * @return com.cssw.fyzb.base.web.domain.AjaxData<com.cssw.fyzb.wap.model.vo.AppealTypeVo>
     * @Param [appealId]
     **/
    public AjaxData<AppealTypeVo> listAppealType() {
        Request request = new Request("ListAppealType");
        return convertData(busiClient.send(request));
    }


}
